import React from 'react';
import { observer, inject } from 'mobx-react';
import { withRouter } from 'react-router-dom';
import { PullToRefresh } from 'weaver-mobile';
import { toJS } from 'mobx';
import EntrancePage from '../../tabPages/entrance';

@inject('homePageTestStore')
@withRouter
@observer
export default class Home extends React.Component {
  render() {
    const { menuConfig, activeKey, onChange, showGroup, disableMenu, isMenuInited, getCorner, isEdit } = this.props.homePageTestStore;

    if (!isEdit){
      return (
        <PullToRefresh
          style={{ height: '100%', overflow: 'scroll' }}
          className="wm-menu-preview-pull-refresh"
          onRefresh={() => {
            // getWfCount();
             getCorner();
          }}
        >
          <EntrancePage
            menuConfig={toJS(menuConfig)}
            activeKey={toJS(activeKey)}
            onChange={onChange}
            disableMenu={disableMenu}
            isMenuInited={isMenuInited}
            showGroup={showGroup}>
          </EntrancePage>
        </PullToRefresh>
      )
    } else {
      return (
        <EntrancePage
          menuConfig={toJS(menuConfig)}
          activeKey={toJS(activeKey)}
          onChange={onChange}
          disableMenu={disableMenu}
          isMenuInited={isMenuInited}
          showGroup={showGroup}>
        </EntrancePage>
      )
    }
  }
}

